-- town1 - "The Capital"

function autoexec()
end


function postexec()
end

function zone_handler(zn)
  if (zn == 1) then
    door_in("a_e")

  elseif (zn == 2) then
    door_in("d_e")

  elseif (zn == 3) then
    door_in("inn_we")

  elseif (zn == 4) then
    door_in("inn_ee")

  elseif (zn == 5) then
    door_in("w_e")

  elseif (zn == 6) then
    --statue

  elseif (zn == 7) then
    thought(HERO1,"Why should I climb over the wall when I can walk through the gate?")

  elseif (zn == 8) then
    thought(HERO1,"The guards would see me climb the wall.")

  elseif (zn == 9) then
    thought(HERO1,"You look into the water, and see a reflection of a rather ugly looking hero.")

  elseif (zn == 10) then
    change_map("land","cap_exit")

  elseif (zn == 11) then
    --change_map("castle",20,42,21,42)
    thought(HERO1, "The portcullis is down. I can go no further.")
  elseif (zn == 12) then
    touch_fire(get_pidx(0))

  elseif (zn == 13) then
    door_out("a_x")

  elseif (zn == 14) then

  elseif (zn == 15) then

  elseif (zn == 16) then
    shop(10)

  elseif (zn == 17) then
    shop(21)

  elseif (zn == 18) then

  elseif (zn == 19) then
    door_out("d_x")

  elseif (zn == 20) then
    door_out("w_x")

  elseif (zn == 21) then
    shop(11)

  elseif (zn == 22) then
    door_out("inn_wx")

  elseif (zn == 23) then
    door_out("inn_ex")

  elseif (zn == 24) then
    inn("The Royal Inn",25,3)

  elseif (zn == 26) then
    door_out("inn_nx") 

  elseif (zn == 27) then
    if (get_progress(P_TUNNEL) == 0) then 
      thought(HERO1,"It appears to be an empty rain barrel.")
    else	
      thought(HERO1,"You check if anyone is watching, and then jump in the barrel.")
      change_map("tunnel","tun_enter")  -- tunnel entrance to rebel HQ
      set_progress(P_TUNNEl,2)
    end    
  
  elseif (zn == 28) then
    door_in("inn_ne")

  elseif (zn == 29) then
    door_in("courtyard_x")
  
  elseif (zn == 30) then
    door_out("courtyard_e")
  
  elseif (zn == 31) then
    if ((get_progress(P_QUEST1) == 7) and (get_progress(P_TUNNEL) == 0)) then
      set_progress(P_CARAVEL,1)
      bubble(HERO2,"How have you been Alured?")
      bubble(10,"Good, good.")
      bubble(HERO2,"We came because we accomplished our mission.")
      bubble(10,"Quiet down. Be cautious now, there are other folk about.")
      msg("The bartender leans over the counter and whispers", 255, 0)
      bubble(10,"Was what you found missing a piece?")
      bubble(HERO1,"Yeah just a half a ...?")
      bubble(10,"Well our friends found where the other half is. Go to Grimsby and take a boat to the Island of Thessalia")
      bubble(10,"You'll find the residents different but friendly. The other piece should be in the shrine on the island.")
      bubble(10,"Bring it back here.")
    
    elseif ((get_progress(P_QUEST1) == 8) and (get_progress(P_TUNNEL) == 0)) then
      bubble(HERO1,"It wasn't pretty but we got what we went for.")
      bubble(10,"Go out back into the courtyard. There is a rain barrel out there that has a false bottom. Go take a look.")
      set_progress(P_TUNNEL,1)
      
    else
      inn("The Roasted Boar Inn",75,9)
    end
 
  elseif (zn == 32) then
    change_map("land","cap_exitw")  
 
  elseif (zn == 33) then
    thought(HERO1,"A painting of the Fires of Westin. It's a depiction of a battle where Fiebraes, my father, the Mage General of Diduma called fire down upon the enemies of Diduma.")
  
end
end

function entity_handler(en)
  if (en == 0) then
    bubble(en,"Where is that boy?!")
    bubble(HERO1,"What boy?")
    bubble(en,"My assistant gardener, he has gone missing again.")

  elseif (en == 1) then
    bubble(en,"Grunt")

  elseif (en == 2) then
    bubble(en,"Grunt")

  elseif (en == 3) then
    bubble(3, "I've never been to the capital before.")
    bubble(3, "Isnt it grand?")

  elseif (en == 4) then
    bubble(en,"The shopkeeper is such a sweetie.")

  elseif (en == 5) then
     --misc shopkeeper

  elseif (en == 6) then
     --armor shopkeeper

  elseif (en == 7) then
    bubble(en,"I'm the supplier for this here armoury.")
    bubble(en,"You should take a look around.")

  elseif (en == 8) then
    bubble(en,"Can't you see I'm busy right now?")

  elseif (en == 9) then
     --weapon shopkeeper

  elseif (en == 10) then
    --Alured the innkeeper

  elseif (en == 11) then
    if (prompt(en,2,0,"Did you see my sister out there?","  yes","  no","") == 0) then
    bubble(en,"She's so... annoying some times.")
    else
    bubble(en,"Well you probably don't want to meet her anyways.")
    end

  elseif (en == 12) then
    bubble(en,"I love shopping here.")
    bubble(en,"There is always something good here to buy.")

  elseif (en == 13) then
    bubble(en, "Don't tell the gardener, I'm taking a break right now.")

  end
end

